<extend name="Public/base" />
<block name="body">
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
        <div class="main-title">
            <h2>{$info['id']?'编辑':'添加'}回复列表</h2>
        </div>
	<!-- 标签页导航 -->
<div class="tab-wrap">
	<div class="tab-content">
	<!-- 表单 -->
    <form id="form" action="" method="post" class="form-horizontal">
        <div class="form-item cf">
            <label class="item-label">标题<span class="check-tips">（图文信息不要填标题）</span></label>
            <div class="controls"><input type="text" class="text input-large" name="title" value="{$info.title}"></div>
        </div>
        <div class="form-item cf">
            <label class="item-label">URL<span class="check-tips">（图文信息不要填写URL和上传图片）</span></label>
            <div class="controls"><input type="text" class="text input-large" name="url" value="{$info.url}"></div>
        </div>
        <div class="form-item cf">
            <label class="item-label">排序<span class="check-tips">（图文排序）</span></label>
            <div class="controls"><input type="text" class="text input-large" name="srot" value="{$info.srot}"></div>
        </div>
        <div class="controls">
            <label class="item-label">封面图片</label>
            <input type="file" id="upload_picture">
            <input type="hidden" name="img" id="img" value="{$info['img']|default=''}"/>
            <div class="upload-img-box">
                <notempty name="info['img']">
                    <div class="upload-pre-item"><img src="{$info.img|get_cover='path'}"/></div>
                </notempty>
            </div>
        </div>
        <script type="text/javascript">
            //上传图片
            /* 初始化上传插件 */
            $("#upload_picture").uploadify({
                "height": 30,
                "swf": "__STATIC__/uploadify/uploadify.swf",
                "fileObjName": "download",
                "buttonText": "上传图片",
                "uploader": "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                "width": 120,
                'removeTimeout': 1,
                'fileTypeExts': '*.jpg; *.png; *.gif;',
                "onUploadSuccess": uploadPicture,
                'onFallback': function() {
                    alert('未检测到兼容版本的Flash.');
                }
            });
            function uploadPicture(file, data) {
                var data = $.parseJSON(data);
                var src = '';
                if (data.status) {
                    $("#img").val(data.id);
                    src = data.url || '__ROOT__' + data.path;
                    $("#img").parent().find('.upload-img-box').html(
                    '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                    );
                } else {
                    updateAlert(data.info);
                    setTimeout(function() {
                    $('#top-alert').find('button').click();
                    $(that).removeClass('disabled').prop('disabled', false);
                    }, 1500);
                }
            }
        </script>
        <script type="text/javascript">
            UE.getEditor('myEditor', {
                theme:"default", //皮肤
                lang:"zh-cn", //语言
                initialFrameWidth:800,  //初始化编辑器宽度,默认800
                initialFrameHeight:320
            });
        </script>
		<div class="form-item cf">
            <input type='hidden' name='id' value='{$info.id}'>    
			<button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
			<a class="btn btn-return" href="{:U('Custom/index')}">返 回</a>
		</div>
	</form>
	</div>
</div>
</block>

<block name="script">
<script type="text/javascript">
highlight_subnav('{:U('Custom/index')}');
</script>
</block>
